package com.zyw.zhuangdian.util;

import org.apache.commons.lang3.StringUtils;

import java.util.Map;

public class Assert extends org.springframework.util.Assert {
    public static void isNotNull(Map jsonObject, String key, String message) {
        Assert.notEmpty(jsonObject, message);

        if (!jsonObject.containsKey(key)) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void hasKeyAndValue(Map info, String key, String message) {
        isNotNull(info, key, message);
        hasLength(info.get(key) == null ? "" : info.get(key).toString(), message);
    }
    public static void hasKey(Map info, String key, String message) {
        isNotNull(info, key, message);
    }

    public static void notBlank(String s,String message){
        if (StringUtils.isBlank(s)){
            throw new IllegalArgumentException(message);
        }
    }
}
